<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
  <script>
    var reg = /hi|ha/g;
    console.log('shill'.match(reg));  // 输出结果：["hi"]
    console.log('happy'.match(reg));  // 输出结果：["ha"]
  </script>
</body>
</html>